package me.ingxin.android.permission2.ext

import android.Manifest
import android.content.Context
import android.util.Log
import me.ingxin.android.permission2.BODY_SENSORS_BACKGROUND
import me.ingxin.android.permission2.permissionGranted

/**
 * Created on 2023/7/19 by yin
 */
internal class BackgroundBodySensorsPermissionsTask : PlusNormalPermissionTask() {

    override val permission = BODY_SENSORS_BACKGROUND

    override fun hasBasePermission(context: Context): Boolean {
        val bodySensors = context.permissionGranted(Manifest.permission.BODY_SENSORS)
        if (!bodySensors) {
            //没有获取到基础权限，直接失败
            Log.e(
                "BackgroundBodySensorsPermissionsTask",
                "BODY_SENSORS permission not granted, can not request BODY_SENSORS_BACKGROUND"
            )
            return false
        }
        return true
    }
}